/*
 * @Author: Seon.Hu SeonHu@126.com
 * @Date: 2023-09-04 15:21:41
 * @LastEditors: Seon.Hu SeonHu@126.com
 * @LastEditTime: 2024-02-04 11:01:16
 * @FilePath: \bg-vben\src\views\iot\device\device.data.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { AdColumn } from '@/components/AdVxeTable';
import { useI18n } from '@/hooks/web/useI18n';
import { getDeviceStatusEnumSchema } from '@/enums/iot/deviceStatusEnum';

const deviceStatusEnumSchema = getDeviceStatusEnumSchema();

const { t } = useI18n();

export const columns: AdColumn[] = [
  {
    title: t('entity.idTitle'),
    field: 'Id',
    width: 150,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'integer',
  },
  {
    title: t('iot.route.state.device.deviceIdText'),
    field: 'DeviceId',
    width: 150,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'integer',
  },
  {
    title: t('iot.route.state.device.deviceNameText'),
    field: 'DeviceName',
    width: 180,
    formVisible: true,
    formEditable: false,
    filterable: true,
    filterIndex: 'Device.Name',
    dataType: 'string',
  },
  {
    title: t('iot.route.state.device.statusText'),
    field: 'Status',
    width: 100,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'enum',
    enumData: deviceStatusEnumSchema,
  },
  {
    title: t('iot.route.state.device.createdTimeText'),
    field: 'CreatedTime',
    width: 180,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'datetime',
  },
  {
    title: t('iot.route.state.device.endedTimeText'),
    field: 'EndedTime',
    width: 180,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'datetime',
  },
  {
    title: t('iot.route.state.device.elapsedText'),
    field: 'Elapsed',
    // width: 120,
    minWidth: 120,
    formVisible: true,
    formEditable: false,
    filterable: false,
    dataType: 'number',
  },
  {
    title: t('iot.route.state.device.enabledText'),
    field: 'Enabled',
    width: 90,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'boolean',
  },
  {
    title: t('iot.route.state.device.connectedText'),
    field: 'Connected',
    width: 90,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'boolean',
  },
];
